package entity

import "github.com/jinzhu/gorm"

type Author struct {
	*gorm.Model
	NickName   string `json:"nick_name"`
	BriefIntro string `json:"brief_intro"`
	AvatarUrl  string `json:"avatar_url"`
	QQNumber   string `json:"qq_number"`
	Appeal     string `json:"appeal" `
}

func (a Author) Get(db *gorm.DB) (Author, error) {
	var author Author
	err := db.First(&author).Error
	if err != nil && err != gorm.ErrRecordNotFound {
		return author, err
	}
	return author, nil
}
